Inside Macintosh: Sound

| Previous | Chapter contents | Chapter top | Section top | Next |

Audio Selection Records

You can pass a pointer to an audio selection record to the SndStartFilePlay function to play only part of a sound in a file on disk. The AudioSelection data type defines an audio selection record.

TYPE AudioSelection =
PACKED RECORD
    unitType:       LongInt;        {type of time unit}
    selStart:       Fixed;          {starting point of selection}
    selEnd:         Fixed;          {ending point of selection}
END;
unitType
The type of unit of time used in the selStart and selEnd fields. You can set this to seconds by specifying the constant unitTypeSeconds .
selStart
The starting point in seconds of the sound to play. If selStart is greater than selEnd , SndStartFilePlay returns an error.
selEnd
The ending point in seconds of the sound to play.

Use a constant to specify the unit type.

CONST
    unitTypeSeconds                 = $0000;        {seconds}
    unitTypeNoSelection             = $FFFF;        {no selection}

If the value in the unitType field is unitTypeNoSelection , then the values in the selStart and selEnd fields are ignored and the entire sound plays. Alternatively, if you wish to play an entire sound, you can pass NIL instead of a pointer to an audio selection record to the SndStartFilePlay function.


© 1998 Apple Computer, Inc.

| Previous | Chapter contents | Chapter top | Section top | Next |